<?php if (!defined('THINK_PATH')) exit(); /*a:5:{s:57:"E:\PHP\phpWeb2/application/admin\view\admin\catalogs.html";i:1523880340;s:45:"./application/index/view/index/head_meta.html";i:1523887169;s:45:"./application/index/view/index/head_link.html";i:1523885480;s:47:"./application/index/view/index/head_script.html";i:1523888907;s:57:"E:\PHP\phpWeb2\application\admin\view\admin\navigate.html";i:1523897881;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <base href="<?php echo BASE_PATH; ?>">
    <title>首页</title>
    <!--引入头部meta文件 -->
    <meta name="pragma" content="no-cache">
<meta name="cache-control" content="no-cache">
<meta name="expires" content="0">
<meta name="keywords" content="<?php echo \think\Config::get('keywords'); ?>">
<meta name="description" content="<?php echo \think\Config::get('description'); ?>">
<meta http-equiv="Content-Type" content="<?php echo \think\Config::get('Content_Type'); ?>" />
<meta name="robots" content="<?php echo \think\Config::get('robots'); ?>">
<meta name="windows-Target" content="<?php echo \think\Config::get('windows_Target'); ?>">
<meta name="author" content="<?php echo \think\Config::get('author'); ?>">
<meta http-equiv="Content-Language" content="<?php echo \think\Config::get('content_language'); ?>"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="applicable-device" content="pc,mobile">
<meta name="viewport" content="width=device-width, initial-scale=1">
    <!--引入头部link(css)文件 -->
    <link rel="shortcut icon" href="<?php echo \think\Config::get('page_icon'); ?>">
<link rel="stylesheet" href="public/static/css/base.css?v=<?php echo NOW_TIME; ?>"/>
<link rel="stylesheet" href="public/static/plugs/topNav/css/head.css?v=<?php echo NOW_TIME; ?>" />
<link rel="stylesheet" type="text/css" href="public/static/plugs/bootstrap3.3.7/css/bootstrap.css?v=<?php echo NOW_TIME; ?>">
    <!--引入头部script文件 -->
    <script src="public/static/js/jquery-2.0.0.min.js" type="text/javascript" charset="UTF-8" ></script>
<script src="public/static/js/base/base.js" type="text/javascript" charset="UTF-8" ></script>
<script src="public/static/plugs/bootstrap3.3.7/js/bootstrap.js" type="text/javascript" charset="UTF-8" ></script>
<script type="text/javascript" src="public/static/js/jquery.lazyload.min.js"></script>
<!--IE8只能支持jQuery1.9-->
<!--[if lte IE 8]>
<script src="http://cdn.bootcss.com/jquery/1.9.0/jquery.min.js"></script>
<!-->

    <!--=====================CSS_Link===========================-->
    <link href="public/static/css/admin/catalog.css?v=<?php echo NOW_TIME; ?>" type="text/css" rel="stylesheet" />
    <!--=====================JS_Link===========================-->

    <script>
        $(function () {
            $(".nav-title").click(function () {
                $(this).parent().find(".nav2-ul").toggle();
                if($(this).find(".nav-icon").css("background-position")=="-144px -27px"){
                    $(this).find(".nav-icon").css("background-position","-92px -27px");
                }else{
                    $(this).find(".nav-icon").css("background-position","-144px -27px");
                }
            });
        })
    </script>
</head>
<body>
<div class="box">
    <div class="box-left">
        <!--引入导航html文件 -->
        <!--导航-->
<ul class="nav1-ul">
    <li class="nav1-li">
        <h4 class="nav-title"><i class="nav-icon">&nbsp;</i>影片管理</h4>
        <ul class="nav2-ul">
            <a href="<?php echo url('admin/film'); ?>">
                <li class="nav2-li">添加影片</li>
            </a>
            <a href="<?php echo url('admin/film_list'); ?>">
                <li class="nav2-li">所有影片</li>
            </a>
        </ul>
    </li>
    <li class="nav1-li">
        <h4 class="nav-title"><i class="nav-icon">&nbsp;</i>目录管理</h4>
        <ul class="nav2-ul">
            <a href="<?php echo url('admin/catalogs'); ?>">
                <li class="nav2-li">添加目录</li>
            </a>
            <a href="<?php echo url('admin/vip_manager'); ?>">
                <li class="nav2-li">VIP管理</li>
            </a>
        </ul>
    </li>
</ul>
<!--导航-->
    </div>
    <div class="box-right">
        <div style="width:50%;float:left;height: auto;overflow: hidden;">
            <span>一级分类</span><br/>
            <div contenteditable="true" class="catalog_name" style="display: inline-block;"></div>
            <a href="javascript:;" class="add_CataLog_btn btn">添加</a><br/><br/>

            <span>二级子分类</span>
            <select class="cataLog_id">
                <?php if(is_array($cataLogList) || $cataLogList instanceof \think\Collection || $cataLogList instanceof \think\Paginator): $i = 0; $__LIST__ = $cataLogList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$cataLogList_var): $mod = ($i % 2 );++$i;?>
                    <option value="<?php echo $cataLogList_var['id']; ?>"><?php echo $cataLogList_var['name']; ?></option>
                <?php endforeach; endif; else: echo "" ;endif; ?>

            </select><br/>
            <div contenteditable="true" class="subClass_name" style="display: inline-block;"></div>
            <a href="javascript:;" class="add_SubClass_btn btn">添加</a><br/><br/>

            <span>类型</span><br/>
            <select class="cataLog_id_subClass">
                <?php if(is_array($cataLogList) || $cataLogList instanceof \think\Collection || $cataLogList instanceof \think\Paginator): $i = 0; $__LIST__ = $cataLogList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$cataLogList_var): $mod = ($i % 2 );++$i;?>
                    <option value="<?php echo $cataLogList_var['id']; ?>"><?php echo $cataLogList_var['name']; ?></option>
                <?php endforeach; endif; else: echo "" ;endif; ?>
            </select>
            <select class="subClass_id"></select><br/>
            <div contenteditable="true" class="type_name" style="display: inline-block;"></div>
            <a href="javascript:;" class="add_Type_btn btn">添加</a><br/><br/>
            <br/>

            <h2><span style="color:blue;">一级目录</span>--><span style="color:green;">二级目录</span>--><span style="color:#fd5c11;">类型</span></h2><br/>
            <?php if(is_array($cataLogList) || $cataLogList instanceof \think\Collection || $cataLogList instanceof \think\Paginator): $i = 0; $__LIST__ = $cataLogList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$list): $mod = ($i % 2 );++$i;?>
                <span style="color:blue;"><?php echo $list['name']; ?></span><br/>
                <?php if(is_array($list['subClassList']) || $list['subClassList'] instanceof \think\Collection || $list['subClassList'] instanceof \think\Paginator): $i = 0; $__LIST__ = $list['subClassList'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$li): $mod = ($i % 2 );++$i;?>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:green;"><?php echo $li['name']; ?></span>-->
                    <?php if(is_array($typeList) || $typeList instanceof \think\Collection || $typeList instanceof \think\Paginator): $i = 0; $__LIST__ = $typeList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$l): $mod = ($i % 2 );++$i;if($l['subClass']['id'] == $li['id']): ?>
                            <span style="color:#fd5c11;"><?php echo $l['name']; ?></span>
                        <?php endif; endforeach; endif; else: echo "" ;endif; ?>
                    <br/>
                <?php endforeach; endif; else: echo "" ;endif; ?>
                <br/>
            <?php endforeach; endif; else: echo "" ;endif; ?>
        </div>
        <div style="width:50%;float:left;height: auto;overflow: hidden;">


            <span>地区</span><br/>
            <div contenteditable="true" class="loc_name" style="display: inline-block;"></div>
            <a href="javascript:;" class="add_Loc_btn btn" >添加</a><br/><br/>


            <span>级别</span><br/>
            <div contenteditable="true" class="level_name" style="display: inline-block;"></div>
            <a href="javascript:;" class="add_Level_btn btn">添加</a><br/><br/>


            <span>年代</span><br/>
            <div contenteditable="true" class="decade_name" style="display: inline-block;"></div>
            <a href="javascript:;" class="add_Decade_btn btn">添加</a><br/><br/>


            <h2>地区-->级别-->年代</h2>
            <br/>
            <span>地区--></span>
            <?php if(is_array($locList) || $locList instanceof \think\Collection || $locList instanceof \think\Paginator): $i = 0; $__LIST__ = $locList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$locList_list): $mod = ($i % 2 );++$i;?>
                <?php echo $locList_list['name']; endforeach; endif; else: echo "" ;endif; ?>
            <br/>
            <span>级别--></span>
            <?php if(is_array($levelList) || $levelList instanceof \think\Collection || $levelList instanceof \think\Paginator): $i = 0; $__LIST__ = $levelList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$levelList_list): $mod = ($i % 2 );++$i;?>
                <?php echo $levelList_list['name']; endforeach; endif; else: echo "" ;endif; ?>
            <br/>

            <span>年代--></span>
            <?php if(is_array($decadeList) || $decadeList instanceof \think\Collection || $decadeList instanceof \think\Paginator): $i = 0; $__LIST__ = $decadeList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$decadeList_list): $mod = ($i % 2 );++$i;?>
                <?php echo $decadeList_list['name']; endforeach; endif; else: echo "" ;endif; ?>
            <br/>

        </div>
    </div>
</div>
<script>
    $(function () {
        $(".add_CataLog_btn").click(function () {
            var catalog_name = $(".catalog_name").text();
            if(catalog_name!="" && catalog_name){
                $.ajax({
                    url: "<?php echo url('admin/addCataLog'); ?>",
                    type: "POST",
                    dataType: "json",
                    data: "name=" + catalog_name,
                    success: backFunction,
                    error: function () {
                        alert("系统繁忙!");
                    }
                });
            }else{
                alert("字段为空！");
            }
        });

        $(".add_SubClass_btn").click(function () {
            var subClass_name = $(".subClass_name").text();
            if(subClass_name!="") {
                $.ajax({
                    url: "<?php echo url('admin/addSubClass'); ?>",
                    type: "POST",
                    dataType: "json",
                    data: "cataLog_id=" + $(".cataLog_id").val() + "&name=" + subClass_name,
                    success: backFunction,
                    error: function () {
                        alert("系统繁忙!");
                    }
                });
            }else{
                alert("字段为空！");
            }
        });

        $(".add_Type_btn").click(function () {
            var type_name = $(".type_name").text();
            debugger;
            if(type_name!=""){
                $.ajax({
                    url: "<?php echo url('admin/addType'); ?>",
                    type: "POST",
                    dataType: "json",
                    data: "subClass_id=" + $(".subClass_id").val() + "&name=" + type_name,
                    success: backFunction,
                    error: function () {
                        alert("系统繁忙!");
                    }
                });
            }else{
                alert("字段为空！");
            }
        });

        $(".add_Loc_btn").click(function () {
            var loc_name = $(".loc_name").text();
            if(loc_name!=""){
                $.ajax({
                    url: "<?php echo url('admin/addLoc'); ?>",
                    type: "POST",
                    dataType: "json",
                    data: "name=" + $(".loc_name").text(),
                    success: backFunction,
                    error: function () {
                        alert("系统繁忙!");
                    }
                });
            }else{
                alert("字段为空！");
            }
        });

        $(".add_Level_btn").click(function () {
            var level_name = $(".level_name").text();
            if(level_name!="") {
                $.ajax({
                    url: "<?php echo url('admin/addLevel'); ?>",
                    type: "POST",
                    dataType: "json",
                    data: "name=" + $(".level_name").text(),
                    success: backFunction,
                    error: function () {
                        alert("系统繁忙!");
                    }
                });
            }else{
                alert("字段为空！");
            }
        });

        $(".add_Decade_btn").click(function () {
            var decade_name = $(".decade_name").text();
            if(decade_name!="") {
                $.ajax({
                    url: "<?php echo url('admin/addDecade'); ?>",
                    type: "POST",
                    dataType: "json",
                    data: "name=" + $(".decade_name").text(),
                    success: backFunction,
                    error: function () {
                        alert("系统繁忙!");
                    }
                });
            }else{
                alert("字段为空！");
            }
        });

        $(".cataLog_id_subClass").change(function () {
            var catalog_id = $(this).val();
            $.ajax({
                url: "<?php echo url('admin/getSubClass'); ?>",
                type: "post",
                dataType: "json",
                data: "catalog_id=" + catalog_id,
                success: function (data) {
                    $(".subClass_id").find("option").remove();
                    var jss = data;
                    for (var i = 0; i < jss.length; i++) {
                        var op = "<option value='" + jss[i].id + "'>" + jss[i].name + "</option>";
                        $(".subClass_id").append($(op));
                    }
                },
                error: function () {
                    alert("系统繁忙!");
                }
            });
        });

        $.ajax({
            url: "<?php echo url('admin/getSubClass'); ?>",
            type: "POST",
            dataType: "json",
            data: "catalog_id=" + $(".cataLog_id_subClass").val(),
            success: function (data) {
                var jss = data;
                for (var i = 0; i < jss.length; i++) {
                    var op1 = "<option value='" + jss[i].id + "'>" + jss[i].name + "</option>";
                    $(".subClass_id").append($(op1));
                }
            },
            error: function () {
                alert("系统繁忙!");
            }
        });
    })

    function backFunction(data) {
        if (data != "0") {
            location.reload();
        }
    }
</script>
</body>
</html>